﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MySql.Data.MySqlClient;

namespace Aio.Controllers
{
    public class HomeController : Controller
    {
        private cfmm context;// = new CfMm("Server=localhost;Database=cfmm;user=root;providername=MySql.Data.MySqlClient");

        public HomeController()
        {
            MySqlConnection conn = new MySqlConnection("Server=localhost;Database=cfmm;user=root");
            context = new cfmm(conn);
        }

        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            //using (CfMm context = new CfMm("Server=localhost;Database=cfmm;user=root"))
            //{
            //    var results = from s in context.AiODiscIPLInA
            //                  select s.DiscIPLInA;
            //}

            //var results = from s in context.AiOUsUarIo
            //              select s;
            //String teste;
            //foreach (AiOUsUarIo i in results)
            //{
            //    teste = i;
            //}

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult Users()
        {
            var results = from s in context.aiousuario
                          select s;
            return View(results);
        }
    }
}
